home *** CD-ROM | disk | FTP | other *** search
/ Zoom 2 / Zoom - Release 2 (1996)(Active Software)[!].iso / texts / amoszine / arts / tl_arrays.asc < prev   
Text File  |  1992-09-02  |  2KB  |  46 lines

  1. @2{ARRAYS IN AMOS
  2. @3
  3. }Thomas Lancaster
  4. @4
  5.  
  6.   You  probably  all know how to use arrays in AMOS.  If not you`re missing
  7.   out  on  a  treat  that  is  needed  to  fully appreciate the programming
  8.   language.
  9. @3
  10.   An  array  is  a  storage  area  in  the  computer`s memory.  Just like a
  11.   variable  it  is  given  a name, but it is also given a size.  Because of
  12.   this it is important to set it up before it can be used.
  13. @5
  14.   To do this use the command:
  15. @1
  16.   Dim ARRAY(N) -where ARRAY is the name of the array
  17.                       N is the size of the array.
  18. @4
  19.   The  array  name  follows  the  standard  format of variables in AMOS, eg
  20.   NUMBERS  for  numeric  data  or LETTER$ for words.  The command creates a
  21.   series  of  boxes numbered from 0 to N that can each be written to in the
  22.   same  way  as  any other variable (provided the number part or element of
  23.   the array is specified).
  24.  
  25. @4  Each  element  will  initially  be blank, that`s the equivalent of 0 in a
  26.   numerical array or "" in any other.
  27. @3
  28.   For  example try this program to create an array in AMOS and fill it from
  29.   random numbers.
  30. @1
  31.  
  32.   Dim NUMBERS(10)
  33.  
  34.   For COUNTER=0 To 10
  35.     NUMBERS(COUNTER)=Rnd(9)+1
  36.   Next COUNTER
  37.  
  38. @5
  39.   This  is  the equivalent of creating 11 variables and filling them with a
  40.   number  from  1 to 10.  As I`m sure you`ll appreciate this is a much more
  41.   efficient  method and has the advantage that it is much easier to call up
  42.   a  particular  value.   Arrays have major uses in any of today`s games or
  43.   application programs.
  44. @6
  45.   Thomas Lancaster
  46.